package com.family.common.core.oss;

import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author forever
 * Date 2024/11/24 15:54
 */
@Slf4j
public class OssFactory {
    private static final String MINIO = "minio";
    private static final Map<String, OssClient> CLIENT_CACHE = new ConcurrentHashMap<>();


    public static OssClient instance() {

        OssClient client = CLIENT_CACHE.get(MINIO);
        if (client == null) {
            CLIENT_CACHE.put(MINIO, new OssClient());
            log.info("创建OSS实例 key => {}", MINIO);
            return CLIENT_CACHE.get(MINIO);
        }
        return client;
    }
}
